cmake_minimum_required(VERSION 3.16)
project(CameraCarSimulator)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)  # 必须为ON
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

find_package(Qt6 COMPONENTS Core Gui Widgets OpenGLWidgets REQUIRED)

# 包含头文件目录
include_directories(
    ${CMAKE_SOURCE_DIR}/include
)

# 明确列出所有源文件（不要使用GLOB）
set(SOURCES
    src/Environment.cpp
    src/Car.cpp
    src/Camera.cpp
    src/MainWindow.cpp
    main.cpp
)

# 添加可执行文件
add_executable(${PROJECT_NAME} 
    ${SOURCES}
    include/Environment.h   # 手动列出需要MOC处理的头文件
    include/Car.h
    include/Camera.h
    include/MainWindow.h
)

target_link_libraries(${PROJECT_NAME} PRIVATE
    Qt6::Core
    Qt6::Gui
    Qt6::Widgets
    Qt6::OpenGLWidgets
)